<?php

/**
 * Practica filter form base class.
 *
 * @package    gnlab
 * @subpackage filter
 * @author     Miguel Barocchi
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePracticaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'codigo'           => new sfWidgetFormFilterInput(),
      'hits'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'grupo'            => new sfWidgetFormFilterInput(),
      'unidad_resultado' => new sfWidgetFormFilterInput(),
      'valor_defecto'    => new sfWidgetFormFilterInput(),
      'referencia'       => new sfWidgetFormFilterInput(),
      'otros'            => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nombre'           => new sfValidatorPass(array('required' => false)),
      'codigo'           => new sfValidatorPass(array('required' => false)),
      'hits'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'grupo'            => new sfValidatorPass(array('required' => false)),
      'unidad_resultado' => new sfValidatorPass(array('required' => false)),
      'valor_defecto'    => new sfValidatorPass(array('required' => false)),
      'referencia'       => new sfValidatorPass(array('required' => false)),
      'otros'            => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('practica_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Practica';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'nombre'           => 'Text',
      'codigo'           => 'Text',
      'hits'             => 'Number',
      'grupo'            => 'Text',
      'unidad_resultado' => 'Text',
      'valor_defecto'    => 'Text',
      'referencia'       => 'Text',
      'otros'            => 'Text',
    );
  }
}
